Method and system for rate control during video transcoding

ABSTRACT

A local system encodes previously decoded video data using a transcoding quantization value based on a source quantization value provided by a previous encoder as part of the retrieved video data. The transcoding quantization value can be determined additionally based the fullness of the video buffer of a target system, where a measure of the fullness can be obtained directly from the target system or modeled by the local system. The video data is encoded by the local system and then provided to a target system for decoding and subsequent display and/or storage.

FIELD OF THE DISCLOSURE

The present disclosure relates generally to rate control for thetranscoding of pre-encoded digital video and more particularly toefficiently calculating quantization parameters based on the informationextracted from the pre-encoded video to achieve a target bit rate.

BACKGROUND

One common concern when transmitting pre-encoded video data is how toadapt pre-encoded video into communication channels that have differentbandwidths. Most of the pre-encoded video streams are encoded with veryhigh bit rates to ensure high-quality video. Transmitting such high bitrate video streams is usually expensive and sometimes infeasible sincethe communication channel cannot provide enough bandwidth. A commonapproach to reduce a pre-encoded video bit rate is to decode the videoto generate raw pixel data first, and then re-encode the raw pixel dataat a different bit rate. However, this method of simple re-encoding isexpensive in terms of complexity and cost, and may introduce a delayresulting from the frame reordering. It needs one decoder and one fullyfunctional encoder to re-encode video data. Furthermore, since theencoder needs to perform a motion search again and make new encodingdecisions (e.g. picture coding types, macroblock modes and quantizationparameters) based on the decoded data, the video quality generally willdegrade significantly, in an effect known as generation loss or cascadecoding loss.

Another approach to reduce pre-encoded video bit rates is to use atranscoding system that reuses some of the original coding decisions.However, if such a transcoding system uses one or more traditional ratecontrol algorithms, such as the motion pictures experts group-2 testmodel 5 (MPEG2 TM5) rate control algorithm, the quality of thetranscoded video generally will still suffer from degradation due to anumber of factors. One factor is a potential difference between the ratecontrol parameters used by the source system and those used by thetranscoding system. Another factor is the presence of impairments, suchas quantization loss, in the original pre-encoded streams that are notconsidered by the transcoding system. Additionally, the algorithms usedby these types of transcoding systems are computational expensive andinefficient because they often need prior knowledge of the coding typeof a group of pictures, and this information may not be availablebeforehand. Furthermore, a large buffer is often utilized to extractthis information, and a large processing delay can be introduced. Thesecommon transcoding systems also may need to calculate an activityindication of every macroblock in a picture, and often need feedbacksfrom the entropy encoding module for every macroblock.

Given these limitations, as discussed, it is apparent that an improvedrate control method for transcoding of pre-encoded video data would beadvantageous.

BRIEF DESCRIPTION OF THE DRAWINGS

Various advantages, features and characteristics of the presentdisclosure, as well as methods, operation and functions of relatedelements of structure, and the combination of parts and economies ofmanufacture, will become apparent upon consideration of the followingdescription and claims with reference to the accompanying drawings, allof which form a part of this specification.

FIG. 1 is a block diagram illustrating a system for providing videocontent according to at least one embodiment of the present disclosure;

FIG. 2 is a block diagram illustrating an encoder to determine atranscoding quantization value based on a source quantization valueaccording to at least one embodiment of the present disclosure;

FIG. 3 is a block diagram illustrating an application of a quantizationratio to a quantization matrix to modify the values of the quantizationmatrix;

FIG. 4 is a flow diagram illustrating a method for transcoding videocontent according to at least one embodiment of the present disclosure;and

FIG. 5 is a flow diagram illustrating a method for determining aquantization ratio according to at least one embodiment of the presentdisclosure.

DETAILED DESCRIPTION OF THE FIGURES

In accordance with at least one embodiment of the present disclosure, aquantization value for a source macroblock is received and aquantization value for a destination macroblock is determined based onthe source quantization value and an expected amount of data in a videobuffer. One advantage of the present disclosure is that buffer size isminimized since buffering of more than one video picture to determinethe bit allocation is not needed. Another advantage is that bufferoverflow and/or underflow can be avoided. Yet another advantage is thatless effort is required to pipeline of macroblocks since quantizationparameters for an entire picture can be determined in advance. Anadditional advantage is that video quality is improved due to a moreaccurate estimation of the output bit rate.

FIGS. 1-5 illustrate a system and a method for efficient rate control ofpre-encoded video content. In at least one embodiment, a local encoderof a local system encodes previously decoded video data using atranscoding quantization value based on a source quantization valueprovided by a previous encoder as part of the retrieved video data. Thevideo data is encoded by the local system and then provided to a targetsystem for decoding and subsequent display and/or storage. In at leastone embodiment, the transcoding quantization value is determined bytaking a ratio of the source quantization value to a quantization ratio,where the quantization ratio is based on one or more factors, such astranscoding options (the scaling factors that control the output videoresolution and/or the frame dropping flag, for example), bit budget andbit consumption status, and/or characteristics of the video buffer ofthe target system. The characteristics of the video buffer can include afullness of the video buffer and/or a buffer delay that indicates howlong until a buffered frame be decoded and removed by the target system.In one embodiment, the characteristics of the video buffer are obtaineddirectly from the target system, and therefore represent the actualcharacteristics. In another embodiment, the characteristics of the videobuffer are modeled by the local system, such as by modeling a VideoBuffering Verifier (VBV) buffer, and therefore represent expectedcharacteristics. The characteristics of a VBV buffer can be modeled atthe local encoder by comparing the amount of video data sent by thelocal system for input to the video buffer of the target system with theamount of data being output from the video buffer at a known frame rate.

Referring now to FIG. 1, video system 100 is illustrated according to atleast one embodiment of the present disclosure. Video system 100includes source system 101, local system 110, communication medium 155,and target system 160. Local system 110 includes memory 120, sourcebuffer 125, local decoder 130, frame buffer 140 and local encoder 150.In at least one embodiment, local system 110 includes a transcodingsystem for transcoding video data from source system 101. Accordingly,local system 110 is referred to herein as transcoding system 110 which,in one embodiment, can include features similar to those described inpending patent application having attorney docket number VIXS.0100120filed concurrently and entitled “SYSTEM AND METHOD FOR MULTIPLE CHANNELVIDEO TRANSCODING”, which is herein incorporated by reference. Referenceto transcoding system 110 also applies to other embodiments of localsystem 110 unless otherwise noted. Likewise, local encoder 150 and localdecoder 130 are herein referred to as transcoding encoder 150 andtranscoding decoder 130 respectively. Target system 160 includes targetdecoder 170, display 180 and/or storage 190. In at least one embodiment,transcoding system 110 represents a video transcoder. In this case,transcoding system 110 decodes source video data 105 received fromsource system 101 and transcodes the decoded source video data 105 intotarget video data 165, where target video data 165 can have differentproperties than source video data 105, such as a different frame rate, adifferent bit rate, a different resolution, and the like. Target videodata 165 is provided to target system 160 where it can be decoded anddisplayed and/or stored for later retrieval.

Generally, source video data 105 can include video data compressedand/or encoded using one of a variety video encoding/compressionformats. For example, in one embodiment, source video data 105 includesvideo data encoded using a Motion Pictures Experts Group (such asMPEG-2) format. Received source video 105 is stored in transcodingsystem 110, such as in source buffer 125, and then retrieved bytranscoding decoder 130 for decoding. The output of transcoding decoder130 can be stored in frame buffer 140. Source coding informationassociated with the decoding of source video data 105, such asquantization values and motion vectors associated with macroblocks ofsource video data 105, can be sent to transcoding encoder 150 as needed.Source buffer 125 and frame buffer 140, in one embodiment, areimplemented in memory 120 as illustrated in FIG. 1. Memory 120 caninclude one or more of random access memory (RAM), cache, disk storage,and the like, and may include a frame buffer.

Transcoding encoder 150, in one embodiment, re-encodes the decodedoutput of transcoding decoder 130 stored in frame buffer 140 into targetvideo data 165 that can have different characteristics than source videodata 105, such as a different resolution, frame rate, bit rate, and thelike. For instance, transcoding encoder 150 can alter the frame rate bydropping frames. For example, source video data 105 can be encoded tohave a frame rate of 60 frames/second (fps) while a user indicates adesired a frame rate of 30 fps for target video data 165. In this case,transcoding encoder 150 can encode every other source frame stored inframe buffer 140 for inclusion as target video data 165. Transcodingencoder 150 then provides target video data 165 to target system 160 viacommunication medium 155. Communication medium 155 can include awireless medium, a physical medium, or a combination thereof.

Target video data 165, in at least one embodiment, is stored in targetvideo buffer 175 before it is decoded at target system 160. Targetdecoder 170 can retrieve target video data 165 from target video buffer175 and decode it for display on display device 180, where displaydevice 180 can include one of a variety of display devices, such as atelevision, computer monitor, and the like. Alternatively, target videodata 165 can be stored in its encoded and/or decoded form in storage190. Storage 190 can include a variety of storage devices, such as ahard disk, a digital versatile disc (DVD) writer, a memory stick, andthe like.

Ideally, the bit rate of source video data 105 is less than the datatransmission rate of communication medium 155, and the transcodingsystem 110 can be bypassed. However, it will be appreciated this idealscenario is unlikely to occur in many circumstances. For example, atypical HDTV stream is encoded at 18.2M bit/second (bps), while adigital subscriber line (DSL) generally can provide only a 1 Mbps to 3Mbps channel bit rate. For wireless communications, the differencebetween the desired bit rate and the available bit rate is even morepronounced and the channel bandwidth may vary from time to time. In suchcases, transcoding system 110 can be utilized to adapt the bit rate oftarget video data 165 to the channel bit rate of communication medium155. While changing the source video bit rate to the target video bitrate, the rate control module of transcoding system 110 often needs tocontrol the data size of each transcoded frame to avoid overflow orunderflow of video buffer 175 of target system 160.

Ideally, the input data rate to video buffer 175 would equal the outputdata rate from video buffer 175, resulting in zero net change in thefullness of video buffer 175. However, it will be appreciated this idealscenario is unlikely to occur in many video systems. For one, it isunlikely that the frames being transmitted are the same size. Forexample, according to the MPEG standard, encoded frames can includeI-frames, B-frames, and P-frames, each generally having a significantlydifferent data size. For example, because I-frames are intra-encoded andcan therefore be decoded from only the data included in the I-frame,they are generally represented by more data than P-frames and B-frames,which can use prediction data from previous and/or future frames duringdecoding. Likewise, frames of the same type can often have differentamounts of data due to the content of the frame and the quantizationparameters. For a constant data rate communication channel, thetransmission time of a frame is proportional to its size; larger framestake longer time to transmit and smaller frames take shorter time totransmit. As a result, the number of frames an encoder can send to thetarget decoder video buffer per second will vary due the variation ofencoded frame data size, while the target decoder will decode anddisplay video at a fix frame rate, resulting in an increase or decreasein the number of frames and/or the amount of data in the video buffer.

Accordingly, the rate control module in a transcoding system controlseach encoded video frame size so that the average bit rate equal to thechannel data rate and the video buffer 175 of target system 160 won'toverflow or underflow. This is achieved by increasing or reducing theamount of data used to represent frames of target video data 165 basedon underflow or overflow concerns of video buffer 175. For example, inone embodiment, data is transmitted over communication medium 155 at arelatively constant data transmission rate in order to utilize fully thebandwidth of communication medium 155. In this case, the amount of datarepresenting the encoded frames of target video data 165 can beincreased to reduce the number of frames transmitted over a certain timeperiod. Because target decoder 170 decodes video at a fixed frame rate,the larger the frame size, the faster the decoder removing data fromvideo buffer 175. In other words, by controlling the frame data size,the rate control actually controls how fast data is removed from abuffer. If data is removed too fast compare to the channel data rate,buffer underflow occurs, inversely, buffer overflow occurs. The purposeof a rate control module is to make the average output data rate equalto the channel data rate, which is the input data rate of the videobuffer 175. The rate control module is discussed in greater detail withreference to FIG. 2.

In at least one embodiment, the amount of data associated with a frameis increased or reduced by modifying the quantization values of aquantization matrix used to quantize the output of a discrete cosigntransform (DCT) module of transcoding encoder 150. By increasing thequantization values, more zeros are likely to occur in the quantizedoutput, and by decreasing the quantization value, fewer zeros are likelyto occur. The amount of data is generally increased or decreased basedon the number of zeros as a result of a compression operation of anencoder, such as a run-length encoder or variable length encoder on thequantized output. In at least one embodiment, the quantization valueused to quantize a certain macroblock is determined by transcodingencoder 150 based on the previous quantization value used to quantizethe macroblock received from the source and the ratio between the sourcedata rate and the target data rate. Additionally, the quantization valuecan be adjusted according to one or more transcoding options and theexpected fullness of the target video buffer, where the expectedfullness is determined using a hypothetical decoding buffer (e.g. a VBVbuffer) or from fullness information obtained from the target system.Methods to determine the quantization value used to quantize elements ofa destination macroblock or a frame are discussed in greater detailsubsequently.

Referring now to FIG. 2, transcoding encoder 150 is illustrated ingreater detail according to at least one embodiment of the presentdisclosure. Transcoding encoder 150 includes motion compensation module200, discrete cosine transform (DCT) module 210, monitoring module 220,estimation module 230, rate control module 240, quantizer 250, andvariable length encoder 260. Elements of transcoding encoder 150 can beimplemented as software, hardware, firmware, or a combination thereof.

Recall that, in one embodiment, transcoding encoder 150 modifies theamount of data associated with a frame by modifying the sourcequantization value, used by the transcoding system to dequantize thesource video data, to generate a transcoding quantization value. DCTmodule 210 performs a discrete cosine transform on a macroblock of thedecoded and motion compensated source video data (only residual data forinter macroblocks) provided by motion compensation module 200. Quantizer250 then performs a quantization operation on the output of DCT module210 using the transcoding quantization value. The output of quantizer250 is provided to variable length encoder (VLE) 260, where a run-lengthand/or variable-length encoding is performed on the output of quantizer250. The output of VLE 260 can then be buffered, multiplexed and/ortransmitted to a target decoding system, such as target system 160 ofFIG. 1. By modifying the quantization value, the amount of dataassociated with a certain macroblock and/or frame can be increased ordecreased as needed, as discussed previously.

In at least one embodiment, the transcoding quantization value used byquantizer 250 is provided by rate control module 240. One methodemployed by rate control module 240 to determine the transcodingquantization value based on a ratio between the source quantizationvalue and a quantization ratio. This is shown by the following equation:

${trcQ} = \frac{srcQ}{qRatio}$

where trcQ is the transcoding quantization value, srcQ is the sourcequantization value, and qRatio is the quantization ratio. The initialvalue for the quantization ratio (qRatioInit), in one embodiment, is setto the transcoding ratio (trcRatio), which is the ratio between thetarget bit rate (tgtBitRate) and the source bit rate (srcBitRate), shownby the following equation:

${qRatioInit} = {{trcRatio} = \frac{tgtBitRate}{srcBitRate}}$

In at least one embodiment, quantization ratio generator 241 determinesthe quantization ratio based on the initial quantization ratio,transcoding options and the status of the target video buffer.Quantization ratio generator 241 generally attempts to achieve thetarget bit rate while maintaining correct target buffer fullness and toavoid allocating more bits than necessary to the impaired video data.The operation of quantization ratio generator 241 is discussed ingreater detail with reference to FIG. 5.

Monitoring module 220, in one embodiment, emulates and the video bufferof the target system using a local model of the target video buffer,such as a VBV buffer model, to determine an expected characteristic ofthe target video buffer. The value representing the characteristic, suchas VBV delay to represent fullness, is provided to rate control module240. Monitoring module 220 can set the start fullness of the VBV buffermodel to a certain percentage of the VBV buffer size (i.e. 75%+/−0.10),and set the initial VBV delay of the first transcoded frame to reflectthe start fullness of the VBV buffer. After transcoding a frame,monitoring module 220 updates the VBV buffer status by decreasing thesame data amount represented by the transcoded frame from the VBV bufferfullness value, and calculates the VBV delay for the next pictureaccording to the new buffer fullness value. Alternatively, in oneembodiment, modeling module 220 sets the fullness and/or the bufferdelay to its maximum value to indicate that the video being transcodedis a variable bit rate (VBR) stream. In this case, the data size ofevery frame is modified proportionally and the bit rate profile is thesame as the input stream.

Rather than model or emulate the expected fullness of the target videobuffer, in one embodiment, monitoring module 220 directly determines thefullness or the buffer delay of the video buffer. For example,monitoring module 220 can periodically poll a control module thatcontrols the behavior of the video buffer to obtain the fullness of thevideo buffer. For instance, the control module can return the addressvalue of the most recently stored data in the video buffer. This addressvalue can then be used to determine the fullness of the video buffer.For example, the address values of the video buffer can include alinearly increasing sequence of addresses, such as from 0 to 99, wheredata is stored starting at address 0. In this case, by returning anaddress value of 74, then it can be assumed that the video buffer isaround 75% full ((74+1)/(99+1)). Other methods of determining thefullness or buffer delay of a video buffer can be used without departingfrom the spirit or the scope of the present disclosure

Transcoding decoder 130 (FIG. 1), in one embodiment, provides the sourcequantization value to rate control module 240 for generation of thetranscoding quantization value. In one embodiment, transcoding decoder130 extracts the source quantization value from the stored source videodata. In another embodiment, rate control module 240 has access to atable of quantization values, where the source quantization values areprovided by the source system to decode. The source quantization valuecan include a single quantization scale value that is applied to eachelement of a DCT coefficient matrix, or a matrix of quantization valuescorresponding to the DCT coefficient matrix.

Referring to FIG. 3, the effect of various quantization ratios appliedto the source quantization value is illustrated according to at leastone embodiment of the present disclosure. As discussed previously,transcoding quantization value 345 is determined by multiplying sourcequantization value 335 with quantization ratio 320, where quantizationratio 320 is generated by quantization ratio generator 241. As discussedpreviously, the source quantization value 335 may be a combination of aquantization scale value that is applied to each element of a DCTcoefficient matrix and a matrix of quantization values corresponding tothe DCT coefficient matrix.

As illustrated with transcoding quantization matrix 331, the applicationof a quantization ratio 320 of 0.6 to source quantization matrix 310generates transcoding quantization matrix 331 having transcodingquantization values 345 greater than or equal to the correspondingsource quantization values of source quantization matrix 310.Alternatively, applying a quantization ratio 320 of 1.5 results indestination matrix 332 having transcoding quantization values 345 lessthan or equal to the corresponding quantization values of sourcequantization matrix 310. It will be appreciated that usually higher thequantization matrix value results in a quantized DCT coefficient matrixhaving more zeros than lower quantization matrix value. The higher thequantization ratio, the smaller the quantization matrix, and hence thehigher output bit rate. As a result, lower quantization ratio can beused to decrease the amount of data associated with a DCT coefficientmatrix, while higher quantization ratio can be used to increase theamount of data.

Referring to FIG. 4, a method for efficient control the bit rate for atranscoding system, is illustrated according to at least one embodimentof the present disclosure. Method 400 initiates with step 410 whereinitial quantization ratio is calculated as discussed previously withreference to FIG. 2.

In step 420, the quantization ratio to be applied to the sourcequantization value is determined or generated based on the initialquantization ratio calculated in step 410. In at least one embodiment,the quantization ratio is determined based on the bit budgetconsumption, transcoding options and the status of the target buffer,such as its expected fullness. Step 420 is discussed in greater detailwith reference to FIG. 5. In step 430, the source quantization value fora source macroblock of frame being processed is fetched. In step 440,the quantization ratio determined in step 420 is applied to the sourcequantization value to determine the transcoding quantization value. Forexample, rate control module 240 of FIG. 2, in one embodiment, takes theratio between the source quantization value and the quantization ratioto generate the transcoding quantization value. In other embodiments,the transcoding quantization value is determined by other means based onbuffer fullness or buffer delay, such as by applying a non-linearfunction to the source quantization value when certain conditions aremet.

In step 450, the transcoding quantization value determined in step 440is applied to a DCT coefficient matrix representing the selectedmacroblock of the frame to quantize the DCT coefficient matrix. In step460, the quantized DCT coefficient matrix is encoded, using run-length,variable-length encoding, and the like. In step 470, the encoded DCTcoefficient matrix is output to subsequent systems. In step 480, steps410-470 are repeated for some or all of the macroblocks of the framebeing encoded.

Referring next to FIG. 5, step 420 of method 400 (FIG. 4) is illustratedaccording to at least one embodiment of the present disclosure. Step 420initiates with sub-step 510 where the bit consumption is compared to thebit budget. If the bit budget is not equivalent to the bit consumption,an attempt to match the average bit rate with the target bit rate (i.e.the channel bit rate) is made. In at least one embodiment, in order tocompensate the error between the bit budget and the actual bitconsumption, the initial value is adjusted according to the equation:

${qRatio} = {{qRatioInit} \times ( {1.0 - \frac{\underset{i = 1}{\sum\limits^{n}}( {{bitUsed}_{i} - {bitBudget}_{i}} )}{\underset{i = {n - w}}{\sum\limits^{n}}{bitBudget}_{i}}} )}$

If n<w, then w=n

where qRatio is the quantization ratio, qRatioInit is the initialquantization value determined in step 410 (FIG. 4), bitUsed is the (i)thactual output frame size in bits, and w is the size of a moving windowand n is the number of frames that have been encoded. The typical valueof w is 4 to 12. The bit budget, bitBudget, is calculated by equation:bitBudget_(i)=inBitCnt_(i)×trcRatio  (EQ.5-515.2)where inBitCnt is the (i)th input frame data size in bits, trcRatio isthe transcoding ratio determined as discussed with reference to FIG. 2.

In sub-step 520, transcoding options including drop frame and scalevideo are evaluated and compensated for in sub-step 525, if necessary.Compensation of scaling is done through the equation:qRatio=qRatio×(xscale*yscale)^(z)  (EQ.5-525.1)

Where qRatio is the result of sub-step 510 and/or 525 xscale is theratio between the input horizontal frame size and the output horizontalframe size, yscale is the ratio between the input vertical frame sizeand the output vertical frame size, and Z is a constant less than 1. Inat least one embodiment, Z is 0.75+/−0.10. For example, assume that theinput horizontal frame size is 704 pixels and the input vertical framescale is 480 pixels, while the output horizontal frame size of thecorresponding transcoded frame is 352 pixels and the output verticalframe size is 240. In this case, xscale would be 2 (704/352) and yscalewould be 2 (480/240). Also, assume that Z is 0.75. In this case, thecompensation factor would be approximately 2.83 (4 to the power of0.75).

The drop-frame flag, used to indicate a difference in frame displayrates between the source video data and the target video data, can alsobe checked in sub-step 520. For example, if the frame rate of the sourcevideo data is 60 fps and a user indicates a desired frame display rateof 30 fps for the target video data, then an average of one of every twoframes must be dropped. If frames are dropped, compensation is donethrough the equation:qRatio=qRatio×D

Where qRatio is the result of the previous step and D is a constantlarger than 1 and less than 2. In at least one embodiment, D is 1.2 fordropping every other frame. If no frame is dropped, sub-step 520continues to sub-step 530.

In sub-step 530, the fullness of the video buffer is compared to firstindicator value X and at sub-step 540 the fullness of the video bufferis compared to value X and the value of the quantization ratio iscompared to the value of 1.0. Recall that the fullness of the targetvideo buffer can be determined by modeling the video buffer, such asusing a VBV buffer model, or characteristics of the video buffer can beobtained directly from the target system. If the buffer fullness is lessthan first indicator value X and the value of the quantization ratio isgreater than 1.0, then value of the quantization ratio is set to aconstant value Y in step 545. In at least one embodiment, Y is 1.0. Bysetting the quantization ratio to 1.0, the transcoding quantizationvalue will be the same as the source quantization value assuming nofurther modification of the value of the quantization ratio. In oneembodiment, the quantization ratio is set to 1.0 because when the bufferfullness falls below first indicator value X, such as the bufferfullness falling below 75% of the maximum buffer capacity, the videobuffer is assumed to be within desirable operating parameters, or atleast not about to overflow.

If the buffer fullness is larger than first indicator value X, thenthere is no further modification to the quantization ratio, this meansthe quantization level can be set as high as necessary (e.g. larger than1.0) at sub-step 535 to avoid overflow of the target video buffer. Usingquantization ratio larger than 1.0 means using quantization matrixvalues smaller than the source quantization matrix value, this willgenerally increase the transcoded frame size without quality gain (i.e.bits are wasted). So only when the target video buffer is riskingoverflow, in on embodiment, will quantization ratio allowed to be higherthan 1.0. For example, if the buffer fullness is greater than 75% of itscapacity, which means the video buffer may overflow unless the outputdata rate of the video buffer is increase, which can be accomplished byincrease the data size of the following frames. The data size of thefollowing frames, in one embodiment, can be increased by increasing thequantization ratio to generate a lower-valued quantization matrix, andconsequently increase the frame data size. In sub-step 550, the fullnessof the video buffer, is compared to a second indicator value Z. In oneembodiment, second indicator value Z includes the value of 20% +/−1% ofthe maximum buffer capacity of the video buffer. If the valuerepresenting the fullness of the video buffer falls below secondindicator value Z, in one embodiment, the video buffer is considered tohave a potential underflow, and the value of th e quantization ratio ismodified in sub-step 555. In one embodiment, a non-linear function isapplied to the quantization ratio in sub-step 555, the non-linearequation as follows:

${qRatio} = {{qRatio} \times X^{\frac{Y - W}{Z}}}$

Where X is a first constant value, Y is a second constant, W is a valuerepresenting the fullness of the video buffer, and Z is a third constantvalue. In one embodiment, X is 0.9, Y is 13000, and Z is 3000. In thiscase, if the previous value for the quantization ratio is 0.8 and themeasured amount of data in the video buffer (i.e. the fullness of thevideo buffer) is 9000, then the modified value for the quantizationratio would be 0.695. If the buffer fullness is above second indicatorvalue Z, then it is assumed that the video buffer is within desirableoperating parameters. As a result of the modification of the transcodingquantization value based on the fullness of a video buffer and thesource quantization value used to quantize the source video data, thesize of the transcoded frames transmitted and stored in the video buffercan be efficiently modified to prevent overflow and/or underflow of thevideo buffer. Note that the values of X, Y, Z have been empiricallyderived. However, various other values of X, Y, Z can be plugged intothe equation to obtain different quantization ratios, and furtherapproximation of the above equation can be done via numerical methodssuch as Taylor series or quadratic approximations to obtain comparableresults, but any reasonable close approximation of the base equationabove or simplified values of X, Y, Z to simplify computation areclearly varying implementations of the base quantization equation.

The various functions and components in the present application may beimplemented using an information-handling machine such as a dataprocessor, or a plurality of processing devices. Such a data processormay be a microprocessor, microcontroller, microcomputer, digital signalprocessor, state machine, logic circuitry, and/or any device thatmanipulates digital information based on operational instruction, or ina predefined manner. Generally, the various functions, and systemsrepresented by block diagrams are readily implemented by one of ordinaryskill in the art using one or more of the implementation techniqueslisted herein. When a data processor for issuing instructions is used,the instruction may be stored in memory. Such a memory may be a singlememory device or a plurality of memory devices. Such a memory device maybe read-only memory device, random access memory device, magnetic tapememory, floppy disk memory, hard drive memory, external tape, and/or anydevice that stores digital information. Note that when the dataprocessor implements one or more of its functions via a state machine orlogic circuitry, the memory storing the corresponding instructions maybe embedded within the circuitry that includes a state machine and/orlogic circuitry, or it may be unnecessary because the function isperformed using combinational logic. Such an information handlingmachine may be a system, or part of a system, such as a computer, apersonal digital assistant (PDA), a hand held computing device, a cableset-top box, an Internet capable device, such as a cellular phone, andthe like.

In the preceding detailed description of the figures, reference has beenmade to the accompanying drawings that form a part thereof, and in whichis shown by way of illustration specific embodiments in which theinvention may be practiced. These embodiments are described insufficient detail to enable those skilled in the art to practice theinvention, and it is to be understood that other embodiments may beutilized and that logical, mechanical, chemical and electrical changesmay be made without departing from the spirit or scope of the invention.To avoid detail not necessary to enable those skilled in the art topractice the invention, the description may omit certain informationknown to those skilled in the art. Furthermore, many other variedembodiments that incorporate the teachings of the invention may beeasily constructed by those skilled in the art. Accordingly, the presentdisclosure is not intended to be limited to the specific form set forthherein, but on the contrary, it is intended to cover such alternatives,modifications, and equivalents, as can be reasonably included within thespirit and scope of the invention. The preceding detailed descriptionis, therefore, not to be taken in a limiting sense, and the scope of thepresent disclosure is defined only by the appended claims.

1. A method comprising: receiving, at a video transcoder, a firstquantization value for a first macroblock; determining, at the videotranscoder, a second quantization value for the first macroblock basedon the first quantization value, an expected amount of video data in avideo buffer, and a product value of a X scaling value and a Y scalingvalue, wherein the product value is raised to a power of Z where Z isless than one.
 2. The method of claim 1, further comprising modifyingthe first macroblock based on the second quantization value.
 3. Themethod of claim 1, wherein the first quantization value is received froma source of the first macroblock.
 4. The method of claim 1, wherein anaddress location of the video buffer represents the expected amount ofvideo data in the video buffer.
 5. The method of claim 1, wherein abuffer delay value indicating when a frame is to be processed representsthe expected amount of video data in the video buffer
 6. The method ofclaim 5, wherein the buffer delay value is based on a number of framesstored in a buffer location of the video buffer.
 7. The method of claim1, wherein the expected amount of video data is determined based on amodeling of the video buffer.
 8. The method of claim 7, wherein themodeling of the video buffer includes determining a fullness of thevideo buffer based on a difference between an input rate and an outputrate.
 9. The method of claim 7, wherein modeling of the video bufferincludes using a VBV buffer model.
 10. The method of claim 1, whereindetermining further includes determining the second quantization valuebased on a first ratio of an input bit rate to an output bit rate. 11.The method of claim 1, wherein the X scaling value includes a horizontalframe size value and the Y scaling value includes a vertical frame sizevalue.
 12. The method of claim 11, wherein Z is 0.75+/−0.1.
 13. Themethod of claim 1, wherein the second quantization value includes aratio value of the first quantization value to a quantization ratio. 14.The method of claim 13, wherein the quantization ratio is based on theexpected amount of video data.
 15. The method of claim 14, wherein: thequantization ratio includes a first constant value when the expectedamount of video data is greater than a first indicator; the quantizationratio includes a second constant value when the expected amount of videodata is less than the first indicator and greater than a secondindicator; and the quantization ratio is determined from a non-linearfunction when the expected amount of video data is less than the secondindicator.
 16. The method of claim 15, wherein the first indicator is abuffer fullness value of 75%+/−1% of a maximum buffer fullness.
 17. Themethod of claim 15, wherein the second indicator is a buffer fullnessvalue of 20%+/−1% of a maximum buffer fullness.
 18. The method of claim15, wherein the non-linear function includes an equation:R=Q*X ^((Y−W)/Z) where R is the quantization ratio, Q is an initialquantization ratio, X is a first constant value, y is a second constantvalue, W is a value representing the expected amount of video data, andZ is a third constant value.